package com.main.hotel.controller;

import com.main.hotel.entity.OrderInfo;
import com.main.hotel.service.OrderInfoService;
import com.sun.deploy.net.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("orderInfo")
public class OrderInfoController {
  @Autowired
  private OrderInfoService orderInfoService;

  @RequestMapping("/findAllOrder")
  @ResponseBody
  public Page<OrderInfo> findAllOrder(Integer pageNum,int customer_id,String time)
  {
   // response.setHeader("Access-Control-Allow-Origin","*");
    if(pageNum==null||pageNum<=0){
      pageNum=0;
    }else{
      pageNum-=1;
    }
    return orderInfoService.getAllOrder(pageNum,5,customer_id,time);
  }
//  @RequestMapping("/findByOrderName")
//  @ResponseBody
//  public OrderInfo findByOrderName()
//  {
//    OrderInfo orderInfo=orderInfoService.getByOrderName("张三1");
//    System.out.println(orderInfo.toString());
//    return orderInfo;
//  }
}
